home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_geomview.idb / usr / freeware / bin / geomview.z / geomview
Encoding:
Text File  |  1999-01-26  |  4.8 KB  |  154 lines

  1. #! /bin/sh
  2.  
  3. # geomview shell script driver
  4.  
  5. ### If you want to be able to run geomview from a directory other than
  6. ### its distribution directory, or if you want to install it
  7. ### permanently on your system, first decide on a permanent place to
  8. ### keep the geomview distribution directory, and move or copy the
  9. ### entire directory (and all its subdirectories) to that location.
  10. ### Then change "." on the line defining geomview_dir below to the
  11. ### absolute pathname of the distribution directory.  It is important
  12. ### that there be no spaces around the '=' sign.  For example, if the
  13. ### pathname of the geomview distribution directory on your system is
  14. ### "/usr/local/Geomview", change the line below to
  15. ### 
  16. ###     GEOMROOT="/usr/local/Geomview"
  17. ### 
  18. ### Once you have made this change you can install a copy of this
  19. ### shell script anywhere you want (e.g. /usr/local/bin) and use it to
  20. ### invoke geomview.
  21. ###
  22. ### Here is the line to change:
  23.  
  24. GEOMROOT=/usr/freeware/lib/geomview
  25.  
  26. ########################################################################
  27. #
  28. #          DO NOT CHANGE ANYTHING BELOW HERE               #
  29. #
  30. ########################################################################
  31.  
  32. ### Geomview and/or its modules use the following environment
  33. ### variables.  For each of these that does not already have a value,
  34. ### this shell script assigns a value based on the setting of
  35. ### geomview_dir above.  You can override these values if you want by
  36. ### setting them in your shell environment before invoking this
  37. ### script.
  38. ### 
  39. ### GEOMVIEW_DIR: pathname of geomview distribution directory
  40. ### GEOMVIEW_GVX: pathname of executable file "gvx"
  41. ### GEOMVIEW_LOAD_PATH: colon-separated list of directories to search
  42. ###     for files
  43. ### GEOMVIEW_EMODULE_PATH: colon-separated list of directories to search
  44. ###     for modules
  45. ### GEOMVIEW_SYSTEM_INITFILE: pathname of an initialization file to
  46. ###     read upon startup
  47. ### GEOMDATA: [ used only by some modules; for backward compatibility ]
  48. ###     pathname of the data directory
  49.  
  50. MACHTYPE=sgi
  51.  
  52. : ${GEOMROOT=$geomview_dir}
  53. : ${GEOMVIEW_GVX=${GEOMROOT}/bin/${MACHTYPE}/gvx}
  54. suf=
  55.  
  56. # : ${GEOMVIEW_GVX=`dirname $0`/gvx}
  57. : ${GEOMVIEW_LOAD_PATH=.:${GEOMROOT}/data/geom:${GEOMROOT}/data}
  58. : ${GEOMVIEW_EMODULE_PATH=${GEOMROOT}/modules/${MACHTYPE}}
  59. : ${GEOMVIEW_SYSTEM_INITFILE=${GEOMROOT}/data/.geomview}
  60.  
  61. # Geomview no longer uses GEOMDATA, but some external modules do.
  62.  
  63. : ${GEOMDATA=${GEOMROOT}/data}
  64.  
  65.  
  66. export GEOMROOT GEOMVIEW_GVX GEOMVIEW_LOAD_PATH GEOMDATA \
  67.         GEOMVIEW_EMODULE_PATH GEOMVIEW_SYSTEM_INITFILE
  68.  
  69.  
  70. gvx="${GEOMVIEW_GVX}"
  71. case "$gvx" in
  72.   *gvx.[a-zA-Z3])
  73.     gvx="`expr match \"$GEOMVIEW_GVX\" '(.*)\.[^./]*' \| \"$GEOMVIEW_GVX\"`" ;;
  74. esac
  75.  
  76. can_C3D() {
  77.   case "$DISPLAY" in
  78.     :*|unix:*) test -w /dev/fbs/ffb0 || return 1 ;;
  79.   esac
  80.   case `ldd "${gvx}.C3D" 2>&1` in
  81.     *found*|*"No such"*) return 1 ;;
  82.   esac
  83. }
  84.  
  85. gvx_option() {
  86.  case "$1" in
  87.   -ogl|-OGL|-opengl|-OpenGL|-OPENGL)
  88.     suf=.OGL; suf2=.MESA
  89.     if [ "$MACHTYPE" = "solaris" ]; then
  90.         suf=.MESA
  91.         if can_C3D; then suf=.C3D; fi
  92.     fi
  93.     shift ;;
  94.   -mesa|-Mesa|-MESA)
  95.     suf=.MESA; suf2=.OGL ;;
  96.   -x11|-X11)
  97.     suf=.X11; shift ;;
  98.   -c3d|-C3D|-Creator3D|-creator3d)
  99.     suf=.C3D; suf2=.MESA ;;
  100.   -h|-help|-HELP|-\?*)
  101.     echo "For advice on selecting which geomview graphics option to use,
  102. see also \"geomview -graphics\"."
  103.     ;;
  104.   -grap*|-Grap*|-GRAP*)
  105.     if [ -f "$gvx.X11" -o -f "$gvx.MESA" -o -f "$gvx.C3D" -o -f "$gvx.OGL" ]; then
  106.     g=`basename $0`
  107.     echo "The $0 script can invoke any of several executables:"
  108.     test -f "$gvx.X11" && \
  109.       echo "  with geomview's own X software rendering: use $g -x11"
  110.     test -f "$gvx.MESA" && \
  111.       echo "  with Mesa OpenGL-like software rendering: use $g -mesa"
  112.     test -f "$gvx.X11" && \
  113.       echo "  with Sun OpenGL for UltraSparcs with Creator3D: use $g -creator3d"
  114.     test -f "$gvx.OGL" && \
  115.       echo "  with Open GL: use $g -opengl"
  116.     echo "If given, this option MUST BE THE FIRST on geomview's command line."
  117.     echo "Using some variant of Open GL allows transparency and texture-mapping;"
  118.     echo "software OpenGL implementations are slower than $g -x11, but hardware ones"
  119.     echo "run faster."
  120.     echo "To change the default, setenv GEOMVIEW_GVXOPT to the appropriate option."
  121.     fi >&2
  122.     exit 1
  123.     ;;
  124.   *) test ;;
  125.  esac
  126. }
  127.  
  128. gvx_option ${GEOMVIEW_GVXOPT}
  129.  
  130. if gvx_option "$1"; then shift; fi
  131.  
  132.  
  133. if [ "$MACHTYPE" = "solaris" -a -z "$suf" -a -w /dev/fbs/ffb0 ] && can_C3D; then
  134.   echo "$0: Invoking Creator3D version (see \"geomview -graphics\" for info)" >&2
  135.   suf=.C3D
  136. fi
  137.  
  138. if [ -f "$gvx$suf" ]; then
  139.   GEOMVIEW_GVX="$gvx$suf"
  140. elif [ -f "$gvx$suf2" ]; then
  141.   GEOMVIEW_GVX="$gvx$suf2"
  142. elif [ -f "$gvx" ]; then
  143.   GEOMVIEW_GVX="$gvx"
  144. fi
  145. export GEOMVIEW_GVX
  146.  
  147. case "$1" in
  148.   -dbx) GEOMVIEW_DEBUG=1 exec dbx $GEOMVIEW_GVX ;;
  149.   -edge) GEOMVIEW_DEBUG=1 exec edge $GEOMVIEW_GVX ;;
  150.   -gdb) GEOMVIEW_DEBUG=1 exec gdb $GEOMVIEW_GVX ;;
  151.   -xdb) GEOMVIEW_DEBUG=1 exec xdb $GEOMVIEW_GVX ;;
  152.   *) exec $GEOMVIEW_GVX ${1+"$@"} ;;
  153. esac
  154.